<template>
  <div class="page-style">
    <outgoing-btn :select-arr="selectedArr" @search="search" />
    <outgoing-tab :table-data="tabData" @selectedVal="selectedVal" />
    <pagination :total="total" @pagination="pageChange" />
  </div>
</template>

<script>
import outgoingBtn from './components/outgoing/outgoing-btn'
import outgoingTab from './components/outgoing/outgoing-tab'
import pagination from '@/components/Pagination'
import { getOutputList } from '@/api/wms'

export default {
  components: {
    outgoingBtn,
    pagination,
    outgoingTab
  },
  data() {
    return {
      total: 0,
      selectedArr: [],
      p: 1,
      num: 10,
      tabData: [],
      production_order_num: ''
    }
  },
  created() {
    this.getOutputList()
  },
  methods: {
    pageChange(val) {
      console.log(val)
      this.p = val.page
      this.num = val.limit
    },
    selectedVal(val) {
      this.selectedArr = val
    },
    getOutputList() {
      const data = {
        p: this.p,
        num: this.num,
        order_num: this.production_order_num
      }
      getOutputList(data).then(res => {
        console.log(res)
        this.total = Number(res.count)
        this.tabData = res.list
      })
    },
    search(val) {
      console.log(val)
      this.production_order_num = val.bill_num
      this.getOutputList()
    }
  }
}
</script>

<style scoped>

</style>
